<?php
namespace common\models\classify;



use common\models\firstpage\Address;
use common\models\user\Member;

/**
 * This is the model class for table "{{%backend_notify}}".
 *
 * @property string $id 主键
 * @property string $title 标题
 * @property string $content 消息内容
 * @property int $type 消息类型[1:公告;2:提醒;3:信息(私信)
 * @property int $target_id 目标id
 * @property string $target_type 目标类型
 * @property int $target_display 接受者是否删除
 * @property string $action 动作
 * @property int $view 浏览量
 * @property int $sender_id 发送者id
 * @property int $sender_display 发送者是否删除
 * @property int $sender_withdraw 是否撤回 0是撤回
 * @property int $status 状态[-1:删除;0:禁用;1启用]
 * @property int $created_at 创建时间
 * @property string $updated_at 修改时间
 */
class Order extends \common\models\base\BaseModel
{
    public  $name;
    public $phone;
    public $address;
    public $member_name;
    public $member_mobile;
    public $province_id;
    public $city_id;
    public $area_id;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%by_order}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [

            [['order_number', 'order_name','order_cate_id','order_address', 'order_describe', 'img', 'order_statu','order_visiting_time', 'status', 'created_at', 'updated_at'], 'safe'],

        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'order_number' => '订单编号',
            'order_cate_id' => '分类',
            'order_name' => '用户姓名',
            'order_address' => '用户地址',
            'order_describe' => '物品描述',
            'order_statu' => '订单状态',
            'order_visiting_time' => '上门时间',
            'img' => '物品图片',
            'status' => '状态',
            'province_id' => '省',
            'city_id' => '市',
            'area_id' => '区',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'name'=>'用户昵称',
            'phone'=>'手机号',
            'address'=>'详细地址',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     * 关联用户表
     */
    public function getCate()
    {
        return $this->hasOne(Member::class, ['id' => 'order_name']);
    }
    /**
     * 关联地址表
     */
    public function getAddres()
    {
        return $this->hasOne(Address::class, ['id' => 'order_address']);
    }
    /**
     * 关联订单分类
     */
    public function getOrdercate()
    {
        return $this->hasOne(Ordercate::class, ['id' => 'order_cate_id']);
    }
}

